﻿using System;
using System.Text;

namespace EncodingTools {
    public class Base64Encoder : IEncoder, IDecoder {
        private readonly EncodingHelper _encodingHelper = new EncodingHelper();

        public byte[] Encode(byte[] inArray) {
            string ret = _encodingHelper.BytesToString(inArray);
            return Encoding.ASCII.GetBytes(ret);
        }

        public byte[] Decode(byte[] inArray) {
            string str = _encodingHelper.BytesToString(inArray);
            return Convert.FromBase64String(str);
        }
    }
}
